﻿using System;
using Microsoft.Xna.Framework;

namespace Terraria.World.Generation
{
	// Token: 0x02000093 RID: 147
	public abstract class GenSearch : GenBase
	{
		// Token: 0x06000A34 RID: 2612 RVA: 0x0000B02C File Offset: 0x0000922C
		public GenSearch Conditions(params GenCondition[] conditions)
		{
			this._conditions = conditions;
			return this;
		}

		// Token: 0x06000A35 RID: 2613
		public abstract Point Find(Point origin);

		// Token: 0x06000A36 RID: 2614 RVA: 0x003E596C File Offset: 0x003E3B6C
		protected bool Check(int x, int y)
		{
			for (int i = 0; i < this._conditions.Length; i++)
			{
				if (this._requireAll ^ this._conditions[i].IsValid(x, y))
				{
					return !this._requireAll;
				}
			}
			return this._requireAll;
		}

		// Token: 0x06000A37 RID: 2615 RVA: 0x0000B036 File Offset: 0x00009236
		public GenSearch RequireAll(bool mode)
		{
			this._requireAll = mode;
			return this;
		}

		// Token: 0x04000EB7 RID: 3767
		public static Point NOT_FOUND = new Point(int.MaxValue, int.MaxValue);

		// Token: 0x04000EB8 RID: 3768
		private bool _requireAll = true;

		// Token: 0x04000EB9 RID: 3769
		private GenCondition[] _conditions;
	}
}
